import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class CommunicateService {

  // 发送数据源
  private subject: Subject<string> = new Subject<string>();

  // 消费者用来监听的Observerable
  ob = this.subject.asObservable();

  constructor() { }


  emit(val) {
    this.subject.next(val);
  }


}
